using YushengMall.Backend.Api.Repository;
using Microsoft.AspNetCore.Mvc;
using YushengMall.Backend.Api.ParamModel;
using System.Linq;
using YushengMall.Backend.Api.Entity;

namespace YushengMall.Backend.Api
{
    [ApiController]
    [Route("[controller]")]
    public class SystemMenuController : ControllerBase
    {
        private readonly IRepository<SystemMenu> _SystemMenuRepository;
        public SystemMenuController(IRepository<SystemMenu> SystemMenuRepository)
        {
            _SystemMenuRepository = SystemMenuRepository;
        }

        [HttpPost,Route("getmenus")]
        public dynamic getSystemMenu([FromBody]getSystemMenu sheet)
        {
            var Menures = _SystemMenuRepository.Table.Where(x => x.RoleID == sheet.RoleID).FirstOrDefault();

            return Ok(Menures);
        }

    }
}